package cn.felord.springboot.filters;

import lombok.extern.slf4j.Slf4j;

import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;

/**
 * The type Request filter.
 *
 * @author Felordcn
 * @since 10 :09
 */
@Slf4j
public class RequestFilter extends AbstractFilterBean {

    public RequestFilter(String... urlPatterns) {
        super(urlPatterns);
    }

    @Override
    public void internalHandler(ServletRequest request, ServletResponse response) {
        HttpServletRequest httpServletRequest = (HttpServletRequest) request;
        log.info("req from {}", httpServletRequest.getRequestURI());
    }

    @Override
    public int getOrder() {
        return 0;
    }
}
